<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:th="http://www.thymeleaf.org">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <link th:href="@{/erp/assets/css/bootstrap.min.css}" rel="stylesheet"/>
    <link rel="stylesheet" th:href="@{/erp/css/style.css}"/>
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace.min.css}"/>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome.min.css}"/>
    <link rel="stylesheet" th:href="@{/erp/Widget/zTree/css/zTreeStyle/zTreeStyle.css}" type="text/css">
    <link th:href="@{/erp/Widget/icheck/icheck.css}" rel="stylesheet" type="text/css"/>
    <!--[if IE 7]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/font-awesome-ie7.min.css}"/>
    <![endif]-->
    <!--[if lte IE 8]>
    <link rel="stylesheet" th:href="@{/erp/assets/css/ace-ie.min.css}"/>
    <![endif]-->
    <script th:src="@{/erp/js/jquery-1.9.1.min.js}"></script>
    <script th:src="@{/erp/assets/js/bootstrap.min.js}"></script>
    <script th:src="@{/erp/assets/js/typeahead-bs2.min.js}"></script>
    <!-- page specific plugin scripts -->
    <script th:src="@{/erp/assets/js/jquery.dataTables.min.js}"></script>
    <script th:src="@{/erp/assets/js/jquery.dataTables.bootstrap.js}"></script>
    <script th:src="@{/erp/assets/layer/layer.js}" type="text/javascript"></script>
    <script th:src="@{/erp/assets/laydate/laydate.js}" type="text/javascript"></script>
    <script type="text/javascript" th:src="@{/erp/Widget/zTree/js/jquery.ztree.all-3.5.min.js}"></script>
    <script th:src="@{/erp/js/lrtk.js}" type="text/javascript"></script>
    <title>合作关系申请</title>
    <script type="text/javascript">
        $(function () {
            var divv = document.getElementById("typediv2");
            var div = document.getElementById("typediv1");
            console.log($('#abb')[0].checked);
            if ($('#aba')[0].checked) {
                divv.style.display = "block";
            } else {
                divv.style.display = "none";
            }

            if ($('#abb')[0].checked) {
                div.style.display = "block";
            } else {
                div.style.display = "none";
            }
        })

        var test = function (test) {
            var divv = document.getElementById("typediv2");
            if (test.checked) {
                divv.style.display = "block";
            } else {
                divv.style.display = "none";
            }
        }

        var testt = function (testt) {
            // var di = document.getElementById("ace");
            var div = document.getElementById("typediv1");
            // if(di.checked==di.checked){
            if (testt.checked) {
                div.style.display = "block";
            } else {
                div.style.display = "none";
            }
        }
    </script>
</head>
<body>
<div class="margin clearfix">
    <div class="detailed_style clearfix">
        <em class=""></em>
        <p th:text="${par.company.id}" hidden="hidden" id="id"></p>
        <form hidden="hidden">
            <input name="nodeId" value="" id="nodeId">
        </form>
        <div class="shop_logo"><img th:src="'/'+${par.company.companyImage}" width="150" height="150" /></div>
        <ul class="shop_content clearfix">
            <li class="shop_name"><label class="label_name">企业名称：</label><span class="info"
                                                                               th:text="${par.company.companyName}"></span>
                <div class="Authenticate"><i class="icon-yxrz"></i><i class="icon-yhk"></i><i class="icon-sjrz"></i><i
                        class="icon-grxx"></i></div>
            </li>
            <li><label class="label_name">企业类型：</label><span class="info" th:text="${par.company.companyType}"></span>
            </li>
            <li><label class="label_name">经营范围：</label><span class="info" th:text="${par.company.businessScope}"></span>
            </li>
            <li><label class="label_name">申请时间：</label><span class="info" th:text="${par.company.creatTime}"></span>
            </li>
            <li><label class="label_name">状&nbsp;&nbsp;&nbsp;&nbsp;态：</label>&nbsp;&nbsp;<span
                    th:class="${par.company.companyStatus}=='on'?'label label-success radius':'label label-danger radius'" th:text="${par.company.companyStatus}=='on'?'已认证':'待认证'"></span></li>
            <li><label class="label_name">申请人姓名：</label><span class="info" th:text="${par.company.legal}"></span></li>
            <li><label class="label_name">成立日期：</label><span class="info" th:text="${par.company.creatTime}"></span>
            </li>
            <li><label class="label_name">电子邮箱：</label><span class="info" th:text="${par.company.companyEmail}"></span>
            </li>
            <li><label class="label_name">固定电话：</label><span class="info" th:text="${par.company.fixedTel}"></span></li>
            <li><label class="label_name">详细地址：</label><span class="info"
                                                             th:text="${par.company.companyAddress}"></span></li>
        </ul>
    </div>
    <div class="Store_Introduction">
        <div class="title_name">企业简介</div>
        <div class="info">
            <p id="intro" th:text="${par.company.companyIntroduction}"></p>
        </div>
    </div>
    <div class="Store_Introduction">
        <div class="title_name">申请成为</div>
        <div class="info">
            <div class="form-group"><label class="col-sm-1 control-label no-padding-right" for="form-field-1">
                <label><input type="checkbox" th:value="${par.tParRel}" th:checked="${par.tParRel}=='0'" id="aba"
                              class="ace" disabled="disabled"><span class="lbl"></span></label>
                客户</label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                <label class="col-sm-1 control-label no-padding-right" for="form-field-1">
                    <label><input type="checkbox" th:value="${par.tParRel}" th:checked="${par.tParRel}=='1'" id="abb"
                                  class="ace" disabled><span class="lbl"></span></label>
                    供应商</label>
            </div>
            <div class="form-group"><i style="color:#FF0000">*</i><i style="color:#999999">选择客户可设置对方直购价，发送后对方可见</i>
            </div>
            <div class="form-group"><i style="color:#FF0000">*</i><i style="color:#999999">选择经销商可上传合同附件，通过后可查看直购价</i>
            </div>
        </div>
    </div>
</div>
<div class="Store_Introduction" style="display: block;" id="typediv2">
    <div class="title_name"></div>
    <!--产品列表展示-->
    <div class="h_products_list clearfix" id="products_list">
        <div id="scrollsidebar" class="left_Treeview">
            <div class="show_btn" id="rightArrow"><span></span></div>
            <div class="widget-box side_content">
                <div class="side_title"><a title="隐藏" class="close_btn"><span></span></a></div>
                <div class="side_list">
                    <div class="widget-header header-color-green2"><h4 class="lighter smaller">企业产品列表</h4></div>
                    <div class="widget-body">
                        <div class="widget-main padding-8">
                            <div id="treeDemo" class="ztree"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="table_menu_list">
            <table class="table table-striped table-bordered table-hover" id="sample-table" style="width:100%">
                <thead>
                <tr>
                    <th width="60px" style="width:60px!important;">序号</th>
                    <th width="60px" style="width:60px!important;">产品名称</th>
                    <th width="60px" style="width:60px!important;">原价格（元）</th>
                    <th width="60px" style="width:60px!important;">库存件数</th>
                    <th width="60px" style="width:60px!important;">加入时间</th>
                    <th width="60px" style="width:60px!important;">审核状态</th>
                </tr>
                </thead>
                <tbody>

                </tbody>
            </table>
        </div>
    </div>
</div>
</div>
</div>


<div class="Store_Introduction" style="display: none;" id="typediv1">
    <div class="title_name">供应商操作</div>
    <br/><br/>
    <div class="form-group">
        <label class="col-sm-1 control-label no-padding-right" for="form-field-1"><i></i>上传合同： </label>
        <input type="file" style="margin-left:150px;" onchange="previewImage(this)"/>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label no-padding-right" for="form-field-1"><i></i>签订日期： </label>
        <div class="col-sm-9"><input class="inline laydate-icon" id="start1" style=" margin-left:10px;width:300px">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label no-padding-right" for="form-field-1"><i></i>到期时间： </label>
        <div class="col-sm-9"><input class="inline laydate-icon" id="start2" style=" margin-left:10px;width:300px">
        </div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label no-padding-right" for="form-field-1"><i></i>合同名称： </label>
        <div class="col-sm-9"><input type="text" style=" width:300px" class="col-xs-10"></div>
    </div>
    <div class="form-group">
        <label class="col-sm-1 control-label no-padding-right" for="form-field-1"><i></i>添加备注： </label>
        <div class="col-sm-9"><input type="text" style=" width:300px" class="col-xs-10"></div>
    </div>
    <br/>
</div>
<br/>
<div class="Button_operation">

    <button onclick="history.go(-1)" class="btn btn-default radius" type="button">&nbsp;&nbsp;返回上一步&nbsp;&nbsp;</button>
</div>
</body>
</html>
<script>
    jQuery(function ($) {
        var table = $('#sample-table').dataTable({
            "bStateSave": true,//状态保存
            serverSide: true,   //开始服务器分页
            searching:false,  //关闭搜索框
            aoColumnDefs: [
                {"orderable": false, "aTargets": [0, 1, 2, 3, 4, 5]}// 制定列不参与排序
            ],
            ajax: {
                url : '/products/allNodes',
                type : 'post',
                data : function (d) {
                    var data = $('form').serialize();  //获取查询条件
                    //获取分页信息
                    var searchParams= {
                        start : d.start,
                        length : d.length,
                    };
                    data = data + '&' + $.param(searchParams)+'&companyId='+$('#id').text();
                    return data;
                }
            },
            columns : [
                { "data":"id","createdCell":function (td, cellData, rowData, row, col) {
                        $(td).empty().append(row+1);
                    }},
                { "data": "pname" },
                { "data": "pprice" },
                { "data": "count" },
                { "data": "paddtime" },
                { "data": "astatus" ,"createdCell":function (td, cellData, rowData, row, col) {
                        if(cellData=="1"){
                            $(td).empty().append('<span class="label label-success radius">通过</span>')
                        }else if(cellData=="-1") {
                            $(td).empty().append('<span class="label label-danger radius">未通过</span>')
                        }else $(td).empty().append('<span class="label label-warning radius">待审核</span>')
                    }},
            ]
        });

        $(function(){
            /*******树状图*******/
            var setting = {
                async:{
                    enable: true,
                    url:'/categories/getCategories?companyId='+$('#id').text(),
                    autoParam : [ "id","pid","name"]
                },
                view: {
                    dblClickExpand: true,
                    showLine: false,
                },
                data: {
                    simpleData: {
                        enable: true,
                        idKey: "id",
                        pIdKey: "pid",
                        rootPId: ""
                    }
                },
                callback: {
                    onClick:function (treeId,treeNode,d) {
                        $('#nodeId').val(d.id);
                        table.fnUpdate();
                    }
                }
            };

            $.fn.zTree.init($("#treeDemo"), setting);
            var zTree = $.fn.zTree.getZTreeObj("tree");
        });

        $('table th input:checkbox').on('click', function () {
            var that = this;
            $(this).closest('table').find('tr > td:first-child input:checkbox')
                .each(function () {
                    this.checked = that.checked;
                    $(this).closest('tr').toggleClass('selected');
                });

        });


    $(function () {
        $("#products_style").fix({
            float: 'left',
            //minStatue : true,
            skin: 'green',
            durationTime: false,
            spacingw: 30,//设置隐藏时的距离
            spacingh: 260,//设置显示时间距
        });
    });
    });
</script>
<script type="text/javascript">
    //初始化宽度、高度
    $(".widget-box").height($(window).height() - 215);
    $(".table_menu_list").width($(window).width() - 260);
    $(".table_menu_list").height($(window).height() - 215);
    //当文档窗口发生改变时 触发
    $(window).resize(function () {
        $(".widget-box").height($(window).height() - 215);
        $(".table_menu_list").width($(window).width() - 260);
        $(".table_menu_list").height($(window).height() - 215);
    })

    var txt = $("#intro").text();
    $("#intro").html(txt);

    //面包屑返回值
    var index = parent.layer.getFrameIndex(window.name);
    parent.layer.iframeAuto(index);
    $('.Order_form').on('click', function () {
        var cname = $(this).attr("title");
        var chref = $(this).attr("href");
        var cnames = parent.$('.Current_page').html();
        var herf = parent.$("#iframe").attr("src");
        parent.$('#parentIframe').html(cname);
        parent.$('#iframe').attr("src", chref).ready();
        parent.$('#parentIframe').css("display", "inline-block");
        parent.$('.Current_page').attr({"name": herf, "href": "javascript:void(0)"}).css({
            "color": "#4c8fbd",
            "cursor": "pointer"
        });
        //parent.$('.Current_page').html("<a href='javascript:void(0)' name="+herf+" class='iframeurl'>" + cnames + "</a>");
        parent.layer.close(index);

    });
</script>
